import redis.asyncio as redis


class RedisCache:
    def __init__(self):
        self.redis = redis.Redis(host="localhost", port=6379, decode_responses=True)

    async def get(self, key):
        return await self.redis.get(key)

    async def set(self, key, value, ttl=None):
        await self.redis.set(key, value, ex=ttl)